<%@ page import="com.google.zxing.BarcodeFormat" %>
<%@ page import="com.google.zxing.EncodeHintType" %>
<%@ page import="com.google.zxing.MultiFormatWriter" %>
<%@ page import="com.google.zxing.common.BitMatrix" %>
<%@ page import="com.zx.scp.utils.MatrixToImageWriter" %>
<%@ page import="java.util.Hashtable" %>
<%@ page import="com.zx.mobile.SessionHelper" %>
<%
//设置返回头
        response.setHeader("Pragma", "No-cache");
        response.setHeader("Cache-Control", "no-cache");
        response.setDateHeader("Expires", 0);
        String url = (String) request.getSession().getAttribute(SessionHelper.QRCODEURL);
        int width = 640; // 二维码图片宽度
        int height = 640; // 二维码图片高度
        String format = "jpg";// 二维码的图片格式
        Hashtable<EncodeHintType, String> hints = new Hashtable<EncodeHintType, String>();
        hints.put(EncodeHintType.CHARACTER_SET, "utf-8");   // 内容所使用字符集编码
        BitMatrix bitMatrix = new MultiFormatWriter().encode(url, BarcodeFormat.QR_CODE, width, height, hints);
        // 生成二维码
        MatrixToImageWriter.writeToStream(bitMatrix, format, response.getOutputStream());
        //输出
        out.clear();
        out = pageContext.pushBody();
%>